//
//  QMUIButton+CreateButton.m
//  shunlianPower2
//
//  Created by 陈镇 on 2018/10/15.
//  Copyright © 2018年 顺联网络. All rights reserved.
//

#import "QMUIButton+CreateButton.h"

@implementation QMUIButton (CreateButton)
+(instancetype)createButtonTitle:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font{
    QMUIButton *btn = [[QMUIButton alloc] init];
    btn.adjustsButtonWhenHighlighted = NO;
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    btn.titleLabel.font = font;
    return btn;
}
+(instancetype)createButtonImageName:(NSString *)imageName selectImageName:(NSString *)selectImageName{
    QMUIButton *btn = [[QMUIButton alloc] init];
    if (imageName.length > 0) {
        [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    if (selectImageName.length > 0) {
        [btn setImage:[UIImage imageNamed:selectImageName] forState:UIControlStateSelected];
    }
    return btn;
    
}
+(instancetype)createButtonTitle:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font imageName:(NSString *)imageName selectImageName:(NSString *)selectImageName{
    QMUIButton *btn = [[QMUIButton alloc] init];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    btn.titleLabel.font = font;
    if (imageName && imageName.length) {
        [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    if (selectImageName && selectImageName.length) {
        [btn setImage:[UIImage imageNamed:selectImageName] forState:UIControlStateSelected];
    }
    return btn;
}
@end
